#!/bin/bash

# 配置阶段
cmake -S . -B build
if [ $? -ne 0 ]; then
    echo "CMake 配置失败"
    exit 1
fi

# 构建阶段
cmake --build build
if [ $? -ne 0 ]; then
    echo "构建失败"
    exit 1
fi

# 测试阶段
ctest --test-dir build
if [ $? -ne 0 ]; then
    echo "测试失败"
    exit 1
fi

echo "构建和测试全部成功"
